package C牛客入门测试;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 * 如果一个单词通过循环右移获得的单词，我们称这些单词都为一种循环单词。
 * 例如：picture 和 turepic 就是属于同一种循环单词。
 * 现在给出n个单词，需要统计这个n个单词中有多少种循环单词。
 */
public class 循环单词 {

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int countWords = Integer.parseInt(br.readLine());
        String[] words = new String[countWords];
        for (int i = 0; i < countWords; i++) {
            words[i] = br.readLine();
        }
        String doubleWord;
        for (int i = 0; i < words.length; i++) {
            if (!"1".equals(words[i])) {
                doubleWord = words[i] + words[i];
                for (int j = i + 1; j < words.length; j++) {
                    if (doubleWord.contains(words[j]) && words[i].length() == words[j].length()) {
                        words[j] = "1";
                    }
                }
            }

        }

        int count = 0;
        for (int i = 0; i < words.length; i++) {
            if (!"1".equals(words[i])) {
                count++;
            }
        }
        System.out.println(count);
    }

}